package com.module.overview.ui.cardHistoryDetails.provider

import android.widget.RadioGroup
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.common.app.data.bean.overView.HistoryDetailsModel
import com.common.base.utils.ToastUtils
import com.common.base.utils.ViewUtils.getString
import com.module.ble.utils.AllCardTypeConfig
import com.module.overview.R

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/7/12
 *
 * 描述：睡眠-睡眠主观评分卡片
 *
 * 修订历史：完成度0%
 *
 */
class OvSleepSubScoringCardProvider(
    override val itemViewType: Int = AllCardTypeConfig.TYPE_CARD_SLEEP_SUB_SCORING,
    override val layoutId: Int = R.layout.overview_sleep_subjective_scoring_crad_provider
) : BaseItemProvider<HistoryDetailsModel>() {


    init {
    }

    override fun convert(helper: BaseViewHolder, item: HistoryDetailsModel) {

        helper.getView<RadioGroup>(R.id.rgSubjectiveScoring).setOnCheckedChangeListener { radioGroup, i ->
            // 选中状态改变时被触发
            when (i) {
                R.id.rbnNotGood -> ToastUtils.showToast(getString(R.string.common_not_good_hint))
                R.id.rbnAcceptable -> ToastUtils.showToast(getString(R.string.common_activity_hint))
                R.id.rbnGeneral -> ToastUtils.showToast(getString(R.string.common_general_hint))
                R.id.rbnGood -> ToastUtils.showToast(getString(R.string.common_good_hint))
                R.id.rbnExcellent -> ToastUtils.showToast(getString(R.string.common_excellent_hint))

            }
        }

    }

    override fun onViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onViewHolderCreated(viewHolder, viewType)
    }
}